package com.xmwzw.catpu;

import android.os.Bundle;
import android.os.Handler;
import android.support.annotation.Nullable;
import android.text.TextUtils;
import android.view.View;

import com.xmwzw.catpu.databinding.ActivityFeedbackBinding;

public class FeedBackActivity extends BaseActivity {

    @Override
    public int getLayoutId() {
        return R.layout.activity_feedback;
    }

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        final ActivityFeedbackBinding feedbackBinding = getBaseViewBinding();
        feedbackBinding.setShowLoadingDialog(false);
        feedbackBinding.tvSend.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                String s = feedbackBinding.etContent.getText().toString();
                if (TextUtils.isEmpty(s)){
                    showToast("请填写反馈内容");
                    return;
                }
                feedbackBinding.setShowLoadingDialog(true);
                new Handler().postDelayed(new Runnable() {
                    @Override
                    public void run() {
                        showToast("发送成功");
                        feedbackBinding.setShowLoadingDialog(false);
                        finish();
                    }
                },1000);
            }
        });
        feedbackBinding.tvFd.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                finish();
            }
        });
    }
}
